package cn.sh.yhk.controller.basic;

import cn.sh.yhk.controller.BaseController;
import cn.sh.yhk.service.basic.MenuService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * Created with IDEA
 * author:Yhk
 * Date:2019/1/11
 * Time:9:12 AM
 */
@Controller
public class SystemController extends BaseController {
    @Resource
    MenuService menuService;

    @Value("${spring.profiles.active}")
    String val;

    @Value("${spring.datasource.back.url}")
    private String dbUrl;

    @RequestMapping(value = "/homePage")
    String homePage(Model model, HttpSession session) {
        Long id = new Long(getLoginCurrenterUser().getUserId());
        model.addAttribute("menus", menuService.getMenuListByUserId(id).getObject());
        return "index";
    }

    @RequestMapping(value = "/loginPage")
    String loginPage() {
        return "login";
    }


    @RequestMapping(value = "/11112")
    void saaa() {
        System.out.printf(val);
        System.out.printf(dbUrl);
    }
}
